#include<bits/stdc++.h>
using namespace std;
int n,x,ans,cnt,k,maxn,a[100005],p,q;
vector<int> v;
struct node{
    int n1,n2;
}b[100005];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        a[x]++;
        maxn=max(maxn,x);
    }
    v.push_back(0);;
    for(int i=maxn;i>=1;i--)
    {
        if(a[i]>0)
        {
            cnt++;
            v.push_back(cnt);
            b[cnt].n1=a[i];
            b[cnt].n2=a[i];
        }
    }
    ans=n;
    k=cnt;
    for(int i=cnt-1;i>=1;i--)
    {
        q=v[i];
        while(b[q].n1>0&&k>q)
        {
            p=v[k];
            if(b[q].n1>=b[p].n2)
            {
                b[q].n1-=b[p].n2;
                ans-=b[p].n2;
                k--;
            }
            else
            {
                ans=ans-b[q].n1;
                b[p].n2-=b[q].n1;
                b[q].n1=0;
            }
        }
    }
    cout<<ans;
    return 0;
}
